#include <iostream>

using namespace std;

typedef long long LL;

const int N = 1e5 + 10;

int n, a[N];

int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    LL sum = gcd(a[1], a[2]);
    for(int i = 3; i <= n; i++)
    {
        sum = gcd(sum, a[i]);
    }
    cout << sum * n << endl;
    return 0;
}
